package model

import (
	"choujiang/common/db"
	"fmt"
)

type Poster struct {
	Id         int64  `xorm:"INT(11) not null pk autoincr"`
	Title      string `xorm:"VARCHAR(100)"`
	Content    string `xorm:"VARCHAR(255)"`
	Background string `xorm:"VARCHAR(100)"`
	Status     int64  `xorm:"INT(3) not null default 0"`
	CreatedAt  int64  `xorm:"not null default 0 INT(11) created"`
	UpdatedAt  int64  `xorm:"not null default 0 INT(11) updated"`
}

func GetPosterById(pId int64) *Poster {
	poster := new(Poster)
	has, err := db.MysqlEngine.Where("id=?", pId).Get(poster)
	if !has || err != nil {
		fmt.Printf("GetPosterById err: %s\n", err)
	}
	return poster
}
